﻿using System.Collections.Generic;
using Framework.Model;

namespace MvcApplication1.Services
{
    public class CacheWrapper : ICache
    {
        private static readonly Dictionary<string, object> Cache = new Dictionary<string, object>();

        public object this[string s]
        {
            get
            {
                lock (Cache) return Cache.ContainsKey(s) ? Cache[s] : null;
            }
            set
            {
                lock (Cache)
                {
                    if (value == null)
                        Cache.Remove(s);
                    else
                        Cache[s] = value;
                }
            }
        }
    }
}
